package com.gitee.openviducn.inspector.cdr.process;

import com.alibaba.fastjson.JSON;
import com.gitee.openviducn.inspector.cdr.repository.BaseCDRRepository;
import com.gitee.openviducn.inspector.domain.vo.request.WebhookCDRRequest;
import com.gitee.openviducn.inspector.enums.CDREventEnum;
import lombok.extern.slf4j.Slf4j;

import javax.annotation.Resource;

/**
 * 调用过滤器处理
 * @Author: https://gitee.com/wesleyOne
 * @Date: 04.19 2020
 */
@Slf4j
@WebhookCDRProcessor(event = CDREventEnum.FILTER_EVENT_DISPATCHED)
public class FilterEventDispatchedCDRProcessor implements BaseWebhookCDRProcessor  {

    @Resource
    private BaseCDRRepository cdrRepository;

    @Override
    public void process(WebhookCDRRequest request) {
        log.info(JSON.toJSONString(request));
        cdrRepository.save(request);
    }
}
